package com.zhou.qinqingbuy.service;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhou.qinqingbuy.mapper.EbNewsMapper;
import com.zhou.qinqingbuy.model.EbNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EbNewsServiceImpl implements EbNewsService {
    @Autowired
    private EbNewsMapper ebNewsMapper;

    @Override
    public List<EbNews> selectList(Integer pSize, Integer pageSize){
        Page<EbNews> page = new Page(pSize,pageSize);
        Page<EbNews> ebNewsPage = ebNewsMapper.selectPage(page,
                Wrappers.<EbNews>lambdaQuery().
                        orderByDesc(EbNews::getEnCreateTime));//时间降序
        return ebNewsPage.getRecords();
    }
    @Override
    public  EbNews detail(Integer enId){
        return ebNewsMapper.selectById(enId);
    }
}

